<?php

namespace app\api\controller;

use app\api\service\BlockChain;
use app\common\Status;
use app\service\SocketService;
use app\common\CacheKey;
use think\Controller;
use think\Db;
use think\facade\Lang;
use think\Model;

class Task extends Controller
{
    /**
     * @Title: dinosaurBazaar
     * @Describe 定时获取恐龙集市数据
     * @author lijunwei
     * @Date 2021/12/17 16:07
     */
//    public function dinosaurBazaar()
//    {
//        $info = (new BlockChain())->dinosaurBazaar();
//        if ($info) {
//            dump('data success : ok');
//        } else {
//            dump('no data : ok');
//        }
//    }

    /**
     * @Title: getUsers
     * @Describe 获取所有用户
     * @author lijunwei
     * @Date 2021/12/19 10:24
     */
    public function getUsers()
    {
        $info = (new BlockChain())->userNumber();
        if ($info) {
            dump('data success : ok');
        } else {
            dump('no data : ok');
        }
    }

    /**
     * @Title: UserList
     * @Describe 用户恐龙数、金币数、探险数获取
     * @author lijunwei
     * @Date 2021/12/19 11:33
     */
    public function userList()
    {
        $info = (new BlockChain())->userList();
        if ($info) {
            dump('data success : ok');
        } else {
            dump('no data : ok');
        }
    }

    /**
     * @Title: getInfo
     * @Describe 获取基础信息
     * @author lijunwei
     * @Date 2021/12/24 13:48
     */
    public function getInfo()
    {
        $info = (new BlockChain())->info();
        halt($info);
    }

    /**
     * @Title: getContractEvent
     * @Describe 根据区块区间获取所有数据
     * @author lijunwei
     * @Date 2022/1/5 13:42
     */
    public function getContractEvent()
    {
        $info = (new BlockChain())->getContractEvent();
        if ($info) {
            dump('data success : ok');
        } else {
            dump('no data : ok');
        }
    }

    /**
     * @Title: goldRate
     * @Describe 战斗明细表的金币效率更新 (没分钟执行一次)
     * @author lijunwei
     * @Date 2022/1/5 13:43
     */
    public function goldRate()
    {
        $info = (new BlockChain())->goldRate();
        if ($info) {
            dump('data success : ok');
        } else {
            dump('no data : ok');
        }
    }
}

